<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<x:parse xml="${param.xmlstr}" var="xmlData" />
<c:set var="nature_value">
	<x:out select="$xmlData/data/organizations/organization[@submit_org='1']/nature_value" />
</c:set>
<div class="t_bar">
	中心基本情况
</div>
<table class="t_css" id="basic_tab" width="100%" border="0" cellpadding="0" cellspacing="1">
	<col style="width: 20%" />
	<col style="width: 13%" />
	<col style="width: 13%" />
	<col style="width: 13%" />
	<col style="width: 14%" />
	<col style="width: 13%" />
	<col style="width: 14%" />
	<tr >
		<td align="right"><span class="color_red">*</span>中心名称：</td>
		<td colspan="6">
			<input type="text" name="proposal/zh_title" id="zh_title" style="width: 82%;" class="required" maxlength="50" value="<x:out select="$xmlData/data/proposal/zh_title"/>" label="中心名称">
		</td>
	</tr>
	<tr >
		<td align="right"><span class="color_red">*</span>疾病领域临床专科：</td>
		<td colspan="6">
			<input type="text" name="proposal/disease_field"  style="width: 82%;" class="required" maxlength="50" value="<x:out select="$xmlData/data/proposal/disease_field"/>" label="疾病领域临床专科">
		</td>
	</tr>
	<tr>
		<td align="right"><span class="color_red">*</span>归口管理单位：</td>
		<td colspan="3">
			<c:set var="recomend_org">{'id':'<x:out select="$xmlData/data/proposal/recomend_org_value" />','name':'<x:out select="$xmlData/data/proposal/recomend_org_name" />'}</c:set>
			<cpt:tree key="recommended_org" cacheable="false" className="hn_iuput_kuang " readonly="true" value="${recomend_org}"  id="recomend_org" showPattern="all" shieldPattern="0"
				topCheckbox="false" onClick="initTreeValueExt" />
			<input type="hidden" id="recomend_org_value" name="proposal/recomend_org_value" style="width: 80%;" class="required" value="<x:out select="$xmlData/data/proposal/recomend_org_value" />" label="归口管理单位">
			<input type="hidden" name="proposal/recomend_org_name" style="width: 80%;" value="<x:out select="$xmlData/data/proposal/recomend_org_name" />">
		</td>
		<td align="right"><span class="color_red">*</span>申报日期：</td>
		<td colspan="2">
			<c:set var="submit_date">
				<x:out select="$xmlData/data/proposal/submit_date" />
			</c:set>
			<cpt:date id="apply_date_curr" name="proposal/submit_date" value="${submit_date}" className="required date" label="申报日期" ></cpt:date>
		</td>
    </tr>
	<tr>
		<td align="right" >依托单位：</td>
		<td colspan="6">
			<span name="organizations/organization/org_name"><x:out select="$xmlData/data/organizations/organization[@submit_org='1']/org_name" /></span>
		</td>
	</tr>
	<tr>
		<td align="right">中心主任：</td>
		<td align="right">姓名：</td>
		<td>
			<span name="proposal/fzr_psnname"><x:out select="$xmlData/data/zh_persons/zh_person[@submit_psn='1']/basic_info/zh_name"/></span>
		</td>
		<td align="right">职务：</td>
		<td>
			<span  name="proposal/fzr_position"  ><x:out select="$xmlData/data/zh_persons/zh_person[@submit_psn='1']/basic_info/position"/></span>
		</td>
		<td align="right">职称：</td>
		<td>
			<span name="proposal/fzr_prof_title_name"><x:out select="$xmlData/data/zh_persons/zh_person[@submit_psn='1']/basic_info/prof_title_name"/></span>
		</td>
	</tr>

	<tr>
		<td align="right" rowspan="2"><span class="color_red">*</span>中心联系人：</td>
		<td align="right">姓名：</td>
		<td>
			<input type="text"  name="proposal/contact_psn_cname" class="required" maxlength="20" style="text-align: left;"
				   value="<x:out select="$xmlData/data/proposal/contact_psn_cname" />" label="中心联系人-->姓名" >
		</td>
		<td align="right">职务：</td>
		<td>
			<input type="text"  name="proposal/contact_psn_position" class="required" maxlength="20" style="text-align: left;"
				   value="<x:out select="$xmlData/data/proposal/contact_psn_position" />" label="中心联系人-->职务" >
		</td>
		<td  align="right" >职称：</td>
		<td  >
			<c:set var="proftitlevalue">{'id':'<x:out select='$xmlData/data/proposal/contact_prof_title_value' />','name':'<x:out select='$xmlData/data/proposal/contact_prof_title_name' />'}</c:set>
			<cpt:tree key="prof_title" cacheable="false" readonly="true" value="${proftitlevalue }" id="prof_title" name="prof_title" width="68%" showPattern="all" shieldPattern="-1" onClick="initTreeValueExt"   label="职称" />
			<input type="hidden" id="prof_title_value" name="proposal/contact_prof_title_value" value="<x:out select='$xmlData/data/proposal/contact_prof_title_value' />" class="required"  label="中心联系人-->职称"/>
			<input type="hidden" id="prof_title_name" name="proposal/contact_prof_title_name" value="<x:out select='$xmlData/data/proposal/contact_prof_title_name' />" />
		</td>

	</tr>
	<tr>
		<td align="right">电话：</td>
		<td>
			<input type="text"  name="proposal/contact_psn_mobile" class="required" style="text-align: left;" maxlength="30"
				   value="<x:out select="$xmlData/data/proposal/contact_psn_mobile"/>" label="中心联系人-->电话" >
		</td>
		<td align="right">传真：</td>
		<td>
			<input type="text"  name="proposal/contact_psn_fax" class="required " style="text-align: left;" maxlength="30"
				   value="<x:out select="$xmlData/data/proposal/contact_psn_fax"/>" label="中心联系人-->传真" >
		</td>
		<td align="right">邮箱：</td>
		<td>
			<input type="text"  name="proposal/contact_psn_email" maxlength="30" class="required email" style="text-align: left;"
				   value="<x:out select="$xmlData/data/proposal/contact_psn_email"/>" label="中心联系人-->邮箱" >
		</td>

	</tr>




</table>

<input type="hidden" id="if_have_org" name="proposal/if_have_org">
<input type="hidden" name="proposal/cooperation_units" id="cooperation_units" value="<x:out select='$xmlData/data/proposal/cooperation_units'/>"/>
<script type="text/javascript">

	$(function(){
		industrial_enterprise();
		getLen();
		$("#tab1").click();
		$("#fragment-tab1 :text,#fragment-tab1 [type='date']").addClass("input_width");
		$("#fragment-tab1 select").addClass("select_width");
		/*$("table.t_css").each(function(){
			$(this).find("tr").not(".cbTable tr").filter(":even").addClass("li_1");
			$(this).find("tr").not(".cbTable tr").filter(":odd").addClass("li_2");
		});*/
	});

	$(document).ready(function(){
		compare_age();
		industrial_enterprise();
		if($('input:checkbox[name="enterprise_scale"]:checked').val()=="中小企业"){
			$("#technologyEnterprise").removeAttr("disabled");
		}else{
			$("#technologyEnterprise").attr("disabled",true);
		}
	});
	$("table").addClass("table01");
	$("#checkbox_table_").removeClass("table01");
	$("#feaReport_upload").removeClass("table01");
	$('div').find("[id^='checkbox_dyn_']").find("td").css("border",'0px solid');
	function initTreeValueExt(treeId, treeNode) {
		if ((treeNode && treeNode.isParent)) {
			scmWarn("请选择具体的" + $("#" + treeId).attr("label"));
			$("#" + treeId).val("");
			$("#" + treeId).parents("td").find("[name$='" + treeId + "_code'],[id$='" + treeId + "_code']").val("");
			$("#" + treeId).parents("td").find("[name$='" + treeId + "_value'],[id$='" + treeId + "_value']").val("");
			$("#" + treeId).parents("td").find("[name$='" + treeId + "_name'],[id$='" + treeId + "_name']").val("");
			return false;
		}
		var str = treeNode.name;
		var obj = treeNode.parentNode;
		while (obj != null) {
			str = obj.name + "-" + str;
			obj = obj.parentNode;
		}

		$("#" + treeId).parents("td").find("[name$='" + treeId + "_code'],[id$='" + treeId + "_code']").val(treeNode.id);
		$("#" + treeId).parents("td").find("[name$='" + treeId + "_value'],[id$='" + treeId + "_value']").val(treeNode.id);
		$("#" + treeId).parents("td").find("[name$='" + treeId + "_name'],[id$='" + treeId + "_name']").val(str);
	}

/*
function initControlValue(objId){

	    var name="";
	    var obj=$("#"+objId);
	    if(obj.is("select")){
	        name=obj.attr("name");
	        obj.parent().children("input[name$='"+name+"_value'][type='hidden']").val($("#"+objId).find("option:selected").val());
	        $("#"+objId).parent().children("input[name$='"+name+"_name']").val($("#"+objId).find("option:selected").text());
	    }

	    else if(obj.is(":radio")){
	        name=obj.attr("name");
	        if(obj.is(":checked")){//如果被选中
	            //alert($("#"+objId).val());
	            obj.parents("table").find("input[name$='"+name+"_value'][type='hidden']").val($("#"+objId).val());
	            $("#"+objId).parent().children("input[name$='"+name+"_name']").val($("#"+objId).next().text());
	        }
	        else{

	            obj.parents("table").find("input[name$='"+name+"_value'][type='hidden']").val("");
	        }
	    }else if(obj.is(":checkbox")){
	        name=obj.attr("name");
	        if(obj.is(":checked"))//如果被选中
	            obj.parent().find("input[name$='"+name+"_value'][type='hidden']").val($("#"+objId).val());
	        else
	            obj.parent().find("input[name$='"+name+"_value'][type='hidden']").val("");
	    }else{
	        name=obj.attr("id");
	        obj.parents("td").find("input[name$='"+name+"_name'][type='hidden']").val(obj.val());
	        obj.parents("td").find("input[name$='"+name+"_code'][type='hidden']").val($("#"+objId+"_hideId").val());
	    }
	}
*/

	function synchronizationAmount1(){
		var built_institute=$("#built_institute").val();
		if(built_institute !=  ""){
			$("span[id='built_institute_[00]']").html($("#built_institute").val());
			/*$("#total_fund_18").val(parseFloat($("#request_amount").val()).toFixed(2));*/
		}else if(built_institute ==  ""){
			$("input[id='built_institute_[00]']").html("");
		}
	}
	function setCooperationUnits(){
		var cooperation_units="";
		$("#inland tr:gt(1)").each(function(index){
			var cooperation_unit = $(this).find("td:eq(2) input").val().trim();
			/*var orgName = $("#org_name").val().trim();*/
			var orgName = $('span[name$="organizations/organization/org_name"]').html()
			if(!isBlankOrNull(cooperation_unit) && cooperation_unit!=orgName){
				cooperation_units += cooperation_unit+",";
			}
			/* if(!isBlankOrNull(cooperation_unit)){
                 cooperation_units += cooperation_unit+",";
             }*/
		});
		if(cooperation_units!=""){
			cooperation_units=cooperation_units.substring(0,cooperation_units.length-1);
		}
		$("#cooperation_units").val(cooperation_units);
	}
	/***
	 * 勾选中小型企业框时打开科技型中小企业选择
	 * 没有勾选时关闭科技型中小企业选择，并清除隐藏域的值
	 *
	 */
	function removeDisabled(){
		if($('input:checkbox[name="enterprise_scale"]:checked').val()=="中小企业"){
			$("#technologyEnterprise").removeAttr("disabled");
		}else{
			$("#technologyEnterprise").removeAttr("checked");
			$("#technology_enterprise_value").val("");
			$("#technologyEnterprise").attr("disabled",true);
		}
	};
	function initTreeValueExt(treeId, treeNode) {
		if (!(treeNode && (treeNode.level > 0 || !treeNode.isParent))) {
			scmWarn($("#" + treeId).attr("label") + messageTip.researchAreaInvalidDisciplineCode);
			if (treeNode.level == 0) {
				$("#" + treeId).val("");
				$("#" + treeId).parents("td").find("[name$='" + treeId + "_code'],[id$='" + treeId+ "_code']").val("");
				$("#" + treeId).parents("td").find("[name$='" + treeId + "_value'],[id$='" + treeId+ "_value']").val("");
				$("#" + treeId).parents("td").find("[name$='" + treeId + "_name'],[id$='" + treeId+ "_name']").val("");
			}
			return false;
		}
		var str = treeNode.name;
		var obj = treeNode.parentNode;
		while (obj != null) {
			obj = obj.parentNode;
		}
		$("#" + treeId).parents("td").find("[name$='" + treeId + "_code'],[id$='" + treeId+ "_code']").val(treeNode.id);
		$("#" + treeId).parents("td").find("[name$='" + treeId + "_value'],[id$='" + treeId+ "_value']").val(treeNode.id);
		$("#" + treeId).parents("td").find("[name$='" + treeId + "_name'],[id$='" + treeId+ "_name']").val(str);
	}
	function compare_age() {
		var end_date = $("#age_end_date").val();
		var birthday = $("#fzbirthday").val();

		var end_date_year = Number(end_date.substring(0,4));
		var birthday_year = Number(birthday.substring(0,4));

		var end_date_month = Number(end_date.substring(5,7));
		var birthday_month = Number(birthday.substring(5,7));

		var end_date_day = Number(end_date.substring(8));
		var birthday_day = Number(birthday.substring(8));

		var different_value = end_date_year - birthday_year -57;
		var different_value1 = end_date_month - birthday_month;
		var different_value2 = end_date_day - birthday_day;

		if(different_value > 0 || (different_value == 0 && different_value1 > 0 )  || (different_value == 0 && different_value1 == 0  && different_value2 > 0)){
			$("#age").val(1);
		}else{
			$("#age").val(0);
		}
		//onchangeType2();

	}

	/*$("#industrial_enterprise_value").onchange(function(industrial_enterprise){
		var industrial_enterprise_value = $("#industrial_enterprise_value").val();
		if(industrial_enterprise_value==1){
			$("#industrial_value").val(1);
		}else{
			$("#industrial_value").val(0);
		}
	});*/

	function industrial_enterprise() {
		var industrial_enterprise_value = $("#industrial_enterprise_value").val();
		if(industrial_enterprise_value==0){
			$("#industrial_value").val(1);
		}else if(industrial_enterprise_value==1){
			$("#industrial_value").val(0);
		}else {
			$("#industrial_value").val("");
		}

	}
	function getLen() {
		var len=$("#inland tr:gt(1)").length;
		if(len>=2){
			$("#if_have_org").val("1");
		}else{
			$("#if_have_org").val("0");
		}
	}
</script>
